package com.atguigu.quartz;

import com.atguigu.common.utils.QiniuUtils;
import com.atguigu.common.utils.RedisConstant;
import org.springframework.beans.factory.annotation.Autowired;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

import java.util.Set;

public class Quartz {

    @Autowired
    JedisPool jedisPool;

    public void run(){
        Jedis jedis = jedisPool.getResource();
        Set<String> sdiff = jedis.sdiff(RedisConstant.SETMEAL_PIC_RESOURCES, RedisConstant.SETMEAL_PIC_DB_RESOURCES);
        for (String s : sdiff) {
            QiniuUtils.deleteFileFromQiniu(s);
            jedis.srem(RedisConstant.SETMEAL_PIC_RESOURCES,s);
            System.out.println(".....................");
        }
    }
}
